[][src]Crate cloudevents

This crate implements the CloudEvents Spec for Rust.

use cloudevents::{EventBuilder, AttributesReader, EventBuilderV10};
use chrono::{Utc, DateTime};
use url::Url;

let event = EventBuilderV10::new()
    .id("my_event.my_application")
    .source("http://localhost:8080")
    .ty("example.demo")
    .time(Utc::now())
    .build()?;

println!("CloudEvent Id: {}", event.id());
match event.time() {
    Some(t) => println!("CloudEvent Time: {}", t),
    None => println!("CloudEvent Time: None")
}

This crate includes:

If you're looking for Protocol Binding implementations, look at crates:

Re-exports

pub use event::Event;

Modules

event

Provides Event data structure, EventBuilder and other facilities to work with Event.

message

Provides facilities to implement Protocol Bindings.

Structs

EventBuilderV03

Builder to create a CloudEvent V0.3

EventBuilderV10

Builder to create a CloudEvent V1.0

Enums

Data

Event data attribute representation

Traits

AttributesReader

Trait to get CloudEvents Context attributes.

AttributesWriter

Trait to set CloudEvents Context attributes.

EventBuilder

Trait to implement a builder for Event: